<HTML>
<HEAD>
<META NAME="GENERATOR" Content="SOURCEDOC.EXE">
<META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">
<TITLE>FMUSIC_SetInstCallback</TITLE>
<STYLE>
#flush {margin-left: -10p; margin-right: -0p}
#buttonbar {color: white}
</STYLE>
</HEAD>
<BODY TOPMARGIN=0 BGPROPERTIES="FIXED" BGCOLOR="white">
<FONT FACE="ARIAL">
<SPAN ID="flush">
<A NAME="SEE ALSO">
<TABLE WIDTH="100%" COLS=2 BORDER=0 BGCOLOR="#000000">
<TR ALIGN=RIGHT>
<TD ALIGN=LEFT>
<IMG SRC="banner03.gif" WIDTH="88" HEIGHT="31"  BORDER=0>
</TD>
<TD ALIGN=RIGHT VALIGN=TOP>
<FONT FACE="ARIAL" SIZE="2">
<A ID=buttonbar HREF="FMUSIC_PlaySong.html">
<IMG SRC="u_prev.gif" WIDTH="71" HEIGHT="16"  BORDER=0 ALT="Previous Topic">
</A>
<A ID=buttonbar HREF="FMUSIC.html">
<IMG SRC="u_index.gif" WIDTH="47" HEIGHT="16"  BORDER=0 ALT="Index">
</A>
<A ID=buttonbar HREF="FMUSIC_SetLooping.html">
<IMG SRC="u_next.gif" WIDTH="48" HEIGHT="16"  BORDER=0 ALT="Next Topic">
</A>
</FONT></TD><TD WIDTH=15></TD>
</TR>
</TABLE>
</A>
</SPAN>
<A HREF="FMUSIC.html#Functions"><H5>[API function]</A></H5>
<H2><A NAME="FMUSIC_SetInstCallback">FMUSIC_SetInstCallback</A></H2>
Sets a user callback to occur every time a instrument is played, triggered from a MOD, S3M, XM or IT file.<BR>
<P>
<B>signed char	F_API </B><B> </B><B>FMUSIC_SetInstCallback</B><B>(</B><BR>
<B>FMUSIC_MODULE *</B><I>mod</I><B>,</B><BR>
<B>FMUSIC_CALLBACK </B><B> </B><I>callback</I><B>,</B><BR>
<B>int </B><B> </B><I>instrument</I><BR>
<B>);</B><BR>
<H3>Parameters</H3>
<TABLE>
<TR VALIGN=top><TD><I>mod</I></TD>
<TD>The module or song to set the callback for.<BR>
</TD><TR VALIGN=top><TD><I>callback</I></TD>
<TD>The callback function you supply to get called.<BR>
</TD><TR VALIGN=top><TD><I>instrument</I></TD>
<TD>Call the callback when this instrument number is triggered.<BR>
</TD></TABLE>
<H3>Return Value</H3>
On success, TRUE is returned.<BR>
On failure, FALSE is returned.<BR>
<H3>Remarks</H3>
It is important to note that this callback will be called from directly WITHIN the<BR>
mixer / music update thread, therefore it is imperative that whatever you do from this<BR>
callback be extremely efficient.  If the routine takes too long then breakups in the sound<BR>
will occur, or it will basically stop mixing until you return from the function.<BR>
This sort of function is usually best for just setting a flag, or do some simple variable<BR>
manipulation, and then exiting, letting your main thread do what it needs to based on these<BR>
flags or variables.<BR>
------------<BR>
This callback is LATENCY adjusted, so that the callback happens when you HEAR the sound, not when it is mixed, for accurate synchronization.<BR>
Use FSOUND_INIT_DONTLATENCYADJUST if you want it to be called back at mix time, which is useful if you want to control the music interactively.<BR>
------------<BR>
Note : This function is not supported with the MIDI format.<BR>
___________________<BR>
Supported on the following platforms : Win32, WinCE, Linux, Macintosh, XBox, PlayStation 2, GameCube<BR>
<H3>See Also</H3>
<A HREF="FMUSIC_CALLBACK.html">FMUSIC_CALLBACK</A>
, 
<A HREF="FMUSIC_SetOrderCallback.html">FMUSIC_SetOrderCallback</A>
, 
<A HREF="FMUSIC_SetRowCallback.html">FMUSIC_SetRowCallback</A>
, 
<A HREF="FMUSIC_SetZxxCallback.html">FMUSIC_SetZxxCallback</A>
<HR><BR><FONT SIZE="-2">This document copyright &copy;Firelight Technologies, Pty, Ltd, 1999-2002. All rights reserved.</FONT><BR>
<FONT SIZE="-2">Generated Thu Dec 15 17:31:26 2005
 by SourceDoc v0.10, the automated source code documenter.</FONT><BR>
</BODY>
</HTML>
